<?php

/**
 * products_options actions.
 *
 * @package    sf_sandbox
 * @subpackage products_options
 * @author     Your name here
 * @version    SVN: $Id: actions.class.php 8507 2008-04-17 17:32:20Z fabien $
 */
class products_optionsActions extends sfActions
{
  public function executeIndex()
  {
    $this->products_optionsList = ProductsOptionsPeer::doSelect(new Criteria());
  }

  public function executeCreate()
  {
    $this->form = new ProductsOptionsForm();

    $this->setTemplate('edit');
  }

  public function executeEdit($request)
  {
    $this->form = new ProductsOptionsForm(ProductsOptionsPeer::retrieveByPk($request->getParameter('products_options_id')));
  }

  public function executeUpdate($request)
  {
    $this->forward404Unless($request->isMethod('post'));

    $this->form = new ProductsOptionsForm(ProductsOptionsPeer::retrieveByPk($request->getParameter('products_options_id')));

    $this->form->bind($request->getParameter('products_options'));
    if ($this->form->isValid())
    {
      $products_options = $this->form->save();

      $this->redirect('products_options/edit?products_options_id='.$products_options->getProductsOptionsId());
    }

    $this->setTemplate('edit');
  }

  public function executeDelete($request)
  {
    $this->forward404Unless($products_options = ProductsOptionsPeer::retrieveByPk($request->getParameter('products_options_id')));

    $products_options->delete();

    $this->redirect('products_options/index');
  }
}
